package com.hurried1y.manager.factory;

import com.hurried1y.model.OperLog;
import com.hurried1y.service.OperLogService;
import com.hurried1y.utils.SpringUtils;

import java.util.TimerTask;

/**
 * @author Hurried1y
 * @since 2023/6/25 9:20
 *
 * 异步工厂（用于生产异步任务）
 */
public class AsyncFactory {

    public static TimerTask recordOper(final OperLog operLog){
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(OperLogService.class).save(operLog);
            }
        };
    }
}
